import request from "@/utils/request"

export function userLogin(params) {
	return request.post("user/login", params).then(res => {
		return res.data
	})
}

export function userInfo() {
	return request.get("user/info").then(res => {
		return res.data
	})
}

export function userScore() {
	return request.get("user/score").then(res => {
		return res.data
	})
}


export function updateUserInfo(params) {
	return request.put("user/update", params).then(res => {
		return res.data
	})
}

export function userProfession(params) {
	return request.get("user/profession/list", params).then(res => {
		return res.data
	})
}

export function userScoreHistoryList(params) {
	return request.get("user/score/history", {
		params: params
	}).then(res => {
		return res.data
	})
}

/**
 * 添加用户积分
 * @param {Object} params
 */
export function userScoreAdd(params) {
	return request.post("user/score/add", params).then(res => {
		return res.data
	})
}

/**
 * 用户中心汇总数据
 */
export function getOverviewData() {
	return request.get("user/overview").then(res => {
		return res.data
	})
}

/**
 * 收藏列表
 * @param {Object} params
 */
export function collectionList(params) {
	return request.get("user/image/collection", {
		params: params
	}).then(res => {
		return res.data
	})
}

/**
 * 关注列表
 * @param {Object} params
 */
export function attentionList(params) {
	return request.get("user/author/attention", {
		params: params
	}).then(res => {
		return res.data
	})
}

/**
 * 分享列表
 * @param {Object} params
 */
export function shareList(params) {
	return request.get("user/image/share", {
		params: params
	}).then(res => {
		return res.data
	})
}